home *** CD-ROM | disk | FTP | other *** search
-
- //
- //"Copyright (C) BenaTong 1992 All rights reserved"
- //Version 2.00
- //last mod 8/13/1992
-
- #import <objc/Object.h>
- #import <sgtty.h>
-
- #define ON 1
- #define OFF 0
-
- #define EVEN 1
- #define ODD 2
- #define NONE 3
- #define SPACE 4
- #define MARK 5
-
- #define SEC 1000000L
- #define SERIALOK 0
-
- #define PORTNOTOPEN -1
- #define TIMEOUT -2
- #define BADPARITY -3
- #define BADBAUD -4
- #define BADLENGTH -5
-
- @interface Serial:Object
- {
- int ttyPtr;
- int baudrate;
- int par;
- id serialTarget;
- SEL theSelector;
- BOOL notifyStatus;
- char deviceName[20];
- BOOL reEnteredTtyHandler;
- unsigned long timeout;
- unsigned int notifyThreshold;
- }
-
-
- + initialize;
- - init;
- - (int) waitForInput;
- - (int) expectPattern:(int ) seconds: (char*) pattern ;
- - (int) expectStr:(int ) seconds , ... ;
-
- - (int)setNotify:(SEL)aSelector with:anObject;
- - setNotifyStatus:(BOOL)status;
- - (BOOL) getNotifyStatus;
- - setNotifyThreshold:(unsigned int) threshold;
- - (int) getNotifyThreshold;
-
-
- - (int) inputQueueSize;
- - (int) outputQueueSize;
-
- - (int) flushOutput;
- - (int) flushInput;
- - (int) flushAll;
-
-
- - (int) openCBREAK: (const char *) portStr Baudrate:(int) baud
- Parity :(int) parity;
-
- - (int) openRAW: (const char *) portStr Baudrate:(int) baud;
-
- - (BOOL) portIsOpen;
- - (int) closePort;
-
- - (int) serialPrintf: (const char* ) format, ...;
-
- - (int) writeString:(char*)str;
- - (int) readString: (char *) str forMaxOf:(int) max;
- - (int) readString: (char *) str forMaxOf:(int) max term:(char) termChar;
-
- - (int) writeBlock:(char*) buf for:(int) num;
- - (int) readBlock:(char*) buf for:(int) num;
- - (int) readBlock:(char*) buf for:(int) num term:(char) termChar;
-
- - (int) setBaudRate:(int) baud;
- - (int) setParity:(int) parity;
- - (unsigned) setCharacterTimeout:(unsigned) time;
-
- - (int) baudrate;
- - (int) parity;
- - (unsigned) timeout;
- - (int) ttyptr;
-
-
- - (char*) deviceName;
-
- - (int) dropDTR;
- - (int) raiseDTR;
-
- - (int) break;
- - (int) dropBREAK;
- - (int) raiseBREAK;
-
- - (int) useXONXOFF:(BOOL) status;
- - (int) modifyCRLF:(BOOL) status;
-
- - serialTarget;
- - (SEL) selector;
-
- @end
-